package com.mine.modules.vm.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mine.common.annotation.vm.TreeChildrenAnnotation;
import com.mine.common.annotation.vm.TreeIdAnnotation;
import com.mine.common.annotation.vm.TreeParentIdAnnotation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 场景菜单
 * </p>
 *
 * @author author
 * @since 2024-10-15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("vm_layer")
@ApiModel(value="VmLayer对象", description="场景菜单")
public class VmLayer implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id")
    @TreeIdAnnotation("id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @ApiModelProperty(value = "父id")
    @ExcelProperty("父ID")
    @TreeParentIdAnnotation("parentId")
    private String parentId;

    @ExcelProperty("图层名称")
    @ApiModelProperty(value = "图层名称")
    private String layerName;

    @ExcelProperty("图层类型")
    @ApiModelProperty(value = "图层类型")
    private String layerType;

    @ExcelProperty("图层标识")
    @ApiModelProperty(value = "图层标识")
    private String layerCode;

    @ApiModelProperty(value = "组件")
    private String component;

    @ApiModelProperty(value = "场景图层Id")
    @TableField(updateStrategy= FieldStrategy.IGNORED)
    private String sceneLayerId;

    @ApiModelProperty(value = "点位图层Id")
    @TableField(updateStrategy= FieldStrategy.IGNORED)
    private String pointLayerId;

    @ExcelProperty("排序")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @ApiModelProperty(value = "创建人")
    private String createBy;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @ApiModelProperty(value = "更新人")
    private String updateBy;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField(exist = false)
    @TreeChildrenAnnotation("children")
    private List<VmPermission> children;

    public VmLayer() {
    }

    public VmLayer(String id,String parentId, String layerCode, String layerName, String layerLevel,String layerType) {
        this.id = id;
        this.parentId = parentId;
        this.layerCode = layerCode;
        this.layerName = layerName;
        this.layerType = layerType;
    }
}
